﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection.Metadata;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp;
using Volo.Abp.Domain.Entities.Auditing;
using Volo.Abp.MultiTenancy;

namespace mozhi.smarterp.AuthorCenter.Departments
{
    public class Department : AuditedAggregateRoot<Guid>, IMultiTenant
    {
        public Guid? TenantId { get; private set; }

        public string Code { get; private set; }

        public string Name { get; private set; }

        public Guid? ParentId { get; private set; }

        public bool Activated { get; set; }

        private Department()
        {
        }

        public Department(Guid id, string code, string name , bool activated) 
        {
            Id = id;
            Code = code;
            Name = name;
            Activated = activated;
            Validate();
        }

        public void SetParentId(Guid? parentId)
        {
            ParentId = parentId;
        }

        public void Change(string code, string name , bool activated)
        {
            Name = name;
            Code = code;
            Activated = activated;

            Validate();
        }

        #region
        private void Validate()
        {
            Check.NotNull(Code , nameof(Code));
            Check.NotNull(Code, nameof(Code));
        }

        #endregion
    }
}
